
#[derive(Debug)]
pub enum ProtocolError {
    TaskSignatureParseError(String),
    TypeSchemaParseError(String),
    InputFormatError(String),
    OutputFormatError(String),
    DataTypeError(String),
}

use ProtocolError::*;

impl ProtocolError {
    pub fn to_string(&self) -> String {
        match self {
            TaskSignatureParseError(s) => format!("任务签名解析错误: {}", s),
            TypeSchemaParseError(s) => format!("TypeSchema解析错误: {}", s),
            InputFormatError(s) => format!("任务输入格式错误: {}", s),
            OutputFormatError(s) => format!("任务输出格式错误: {}", s),
            DataTypeError(s) => format!("数据类型错误: {}", s),
        }
    }
}